<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/common/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>${appname}-<c:if
		test="${!empty sessionScope._local_node_session}">${sessionScope._local_node_session.nodeName}-</c:if>${si:ctname("NET_TYPE",sessionScope._netType)}
</title>
<%@ include file="/WEB-INF/view/common/css_js_ace.jsp"%>
<script type="text/javascript">
	$('.tipMe').tooltip({
		'placement' : 'top'
	});
	function search(form) {
		$(form).appendPagerParaStr();
		return true;
	}

// 	$(function() {
// 		reloadMonitor();
// 		setInterval(reloadMonitor, 10000);
// 	});

// 	function reloadMonitor() {
// 		$.ajax({
// 			type : "GET",
// 			url : '${ctx}/taskmont/task_data.do',
// 			data : {
// 				jobName : $('#jobName').val(),
// 				status : $('#status').val()
// 			},
// 			success : function(data) {
// 				$("#optDiv").html(data);
// 			}
// 		});
// 	}
</script>
</head>
<body>
	<%@ include file="/WEB-INF/view/common/topbar.jsp"%>
	<div class="main-container" id="main-container">
		<div class="main-container-inner">
			<%@ include file="/WEB-INF/view/common/sidebar.jsp"%>
			<div class="main-content">
				<div class="breadcrumbs" id="breadcrumbs">
					<ul class="breadcrumb">
						<li><a href="#"><i class="icon-home home-icon"></i>首页</a></li>
						<li><a href="#">系统管理</a></li>
						<li><a href="#">定时任务监控</a></li>
						<li class="active">列表</li>
					</ul>
				</div>

				<div class="page-content">
					<div class="row">
						<div class="col-xs-12">

							<div class="widget-box">
								<div class="widget-header widget-header-flat">
									<h5 class="smaller lighter">
										<i class="icon-list"></i> 定时任务监控
									</h5>
								</div>

								<div class="widget-body">
									<div class="widget-main">
										<form id="searchForm" class="form-search"
											action="${ctx}/taskmont/task_list.do" method="post"
											onsubmit="return search(this)">
											<div class="row mg-top12">
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">任务名称：</span> <input
															class="form-control" type="text" name="jobName"
															id="jobName" value="${param.jobName}" />
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-addon">任务状态：</span> <select
															class="form-control form-select" name="status"
															id="status">
															<option value="">全部</option>
															<c:forEach var="qstate" items="${quartz_state}">
																<option value="${qstate}"
																	<c:if test="${qstate eq param.status }"> selected</c:if>>${qstate}</option>
															</c:forEach>
														</select>
													</div>
												</div>
												<div class="col-xs-4">
													<div class="input-group">
														<span class="input-group-btn">
															<button type="submit" class="btn btn-purple btn-sm">
																<i class="icon-search icon-on-right bigger-110"></i> 查询
															</button>&nbsp;&nbsp;
														</span>
													</div>
												</div>
											</div>
										</form>
									</div>
								</div>
							</div>
							<div class="hr hr12 hr-dotted"></div>
							<div id="optDiv">
								<div class="table-responsive">
									<table id="sample-table-1"
										class="table table-striped table-bordered table-hover">
										<thead>
											<tr>
												<th style="width: 7%">任务名称</th>
												<th style="width: 8%">Trigger名称</th>
												<th style="width: 10%">Trigger表达式</th>
												<th style="width: 5%">状态</th>
												<th style="width: 15%">上次执行时间</th>
												<th style="width: 13%">下次执行时间</th>
												<th style="width: 13%">开始执行时间</th>
											</tr>
										</thead>

										<tbody>
											<c:forEach var="vo" items="${jobList}">
												<tr>
													<td>${vo.jobName}&nbsp;</td>
													<td>${vo.triggerName}&nbsp;</td>
													<td class="left"><span class="tipMe"
														title="${vo.cronExpression}">${vo.cronExpression}&nbsp;</span></td>
													<td>${vo.state}&nbsp;</td>
													<td class="left">${vo.prevTime }&nbsp;</td>
													<td class="left">${vo.nexTime}&nbsp;</td>
													<td>${vo.startTime}&nbsp;</td>
												</tr>
											</c:forEach>
										</tbody>
									</table>

									<jsp:include page="/WEB-INF/view/common/pg.jsp">
										<jsp:param value="${ctx}/taskmont/task_list.do" name="url" />
										<jsp:param value="${_total}" name="total" />
										<jsp:param value="${_urlpara}" name="urlpara" />
									</jsp:include>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>
